<% content_for :admin_tools do %>
  <% if @topic && !@topic.new_record? %>
    <p><%= link_to "View Topic History", history_topic_path( @topic ) %>
    <p><%= link_to "View Topic Details", @topic %>
    <% if authorized? @topic %>
      <p><%= link_to "View Survey Results", survey_results_topic_path( @topic ) %>
      <% unless @topic.inactive? %>
        <p><%= link_to "Update Topic Details", edit_topic_path( @topic ) %></p>
        <% if @topic.upcoming_count.zero? %>
          <p><%= link_to "Delete Topic", delete_topic_path( @topic ) %></p>
        <% end %>
          <p><%= link_to "Create New Session", new_topic_session_path( @topic ) %></p>
      <% end %>
    <% end %>
  <% end %>
<% end %>

<% content_for :sidebar do %>
  <% if @topic && !@topic.new_record? %>
    <div class="download-link download-calendar">
      <%= link_to "[add all sessions to calendar]", download_url(@topic, :protocol => "webcal") %>
    </div>
  <% end %>
<% end %>

<% content_for :content do %>
  <%#= error_messages_for 'topic' %>
  <% if @topic && @topic.inactive? %>
    <div class="inactive-topic-message">
      This topic is no longer active. No further sessions will be held.
    </div>
  <% end %> 
  <%= yield %>
<% end %>

<%= render :file => 'layouts/application' %>
